<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:replace="dashboard/header :: header"></head>
<body>
	<div layout:fragment="content">
		<input id="applicationId" name="applicationId" type="hidden" th:value="${param.applicationId}"/>
		<input id="treeName" name="treeName"  type="hidden" /> 
		<input id="treeId" name="treeId"  type="hidden" /> 
		<div class="wrapper" style="padding:0px;">
		<div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
			<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
			<label id="btnHide" title="隐藏搜索">︽</label>
		</div>
		
		<div class="treeSearchInput" id="search">
			<label for="keyword">关键字：</label>
			<input type="text" class="empty" id="keyword" maxlength="50">
			<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
		</div>
		
		<div class="treeExpandCollapse">
			<a href="#" onclick="$.tree.expand()">展开</a> /
			<a href="#" onclick="$.tree.collapse()">折叠</a>
		</div>
		<div id="tree" class="ztree treeselect"></div>
		</div>	
	</div>

	<footer th:replace="dashboard/footer :: footer"></footer>
	<script th:src="@{/resources/js/project.js}"></script>
	
	<link th:href="@{/asserts/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
	<script th:src="@{/asserts/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>

	<script>
		$(function() {
			var url = ctx + "boot/platform/menus/menusDatabaseZtree?applicationId=" + $("input[name=applicationId]").val() ;
			var options = {
		        url: url,
		        expandLevel: 2,
		        onClick : zOnClick 
		    };
			$.tree.init(options);
		});
		
		function zOnClick(event, treeId, treeNode) {
		    var treeId = treeNode.id;
		    var treeName = treeNode.name;
		    $("#treeId").val(treeId);
		    $("#treeName").val(treeName);
		}
	</script>

</body>
</html>
